//
//  DSSetingConfigure.h
//  IntelligentLock
//
//  Created by yj_zhang on 2019/5/24.
//  Copyright © 2019 yj_zhang. All rights reserved.
//

#ifndef DSSetingConfigure_h
#define DSSetingConfigure_h

//weakSelf
#define WS(weakSelf)            __weak __typeof(&*self)weakSelf = self;
#define WO(weakObj, obj)        __weak __typeof(&*obj)weakObj = obj;

//MARK:字体
#define KIMFontSize(A)              [UIFont fontWithName:@"Helvetica-Light" size:adaptFontSize(A*2)]
#define KIMFontRegularSize(A)       [UIFont fontWithName:@"Helvetica" size:adaptFontSize(A*2)]
#define KIMFontMedium(A)            [UIFont fontWithName:@"HelveticaNeue-Medium" size:adaptFontSize(A*2)]
#define KIMFontBold(A)              [UIFont fontWithName:@"HelveticaNeue-Bold" size:adaptFontSize(A*2)]

#define adaptWidth750(num)          [NLAdaptiveFont numberFromWidth750:(num)]
#define adaptWidth375(num)          [NLAdaptiveFont numberFromWidth375:(num)]
#define adaptHeight1334(num)        [NLAdaptiveFont numberFromHeight1334:(num)]
#define adaptHeight667(num)         [NLAdaptiveFont numberFromHeight667:(num)]
#define adaptFontSize(num)          [NLAdaptiveFont numberFontSize:(num)]
#define scaleImgH(num)              [NLAdaptiveFont numberImgScaleH:(num)]
#define scaleImgW(num)              [NLAdaptiveFont numberImgScaleW:(num)]
//默认头像
#define KdefaultAVater              [UIImage imageNamed:@"chat_visitor_avater"]

//MARK:颜色
//默认背景色
#define kDefaultBgColor           [UIColor jk_colorWithHexString:@"#F5F8FA"]
//默认线条的颜色
#define KLineColor                [UIColor jk_colorWithHexString:@"#E4E4E4"]
//默认字体颜色
#define KCommonTextColor          [UIColor jk_colorWithHexString:@"333333"]
//登录界面主题色
#define KAppMainColor            [UIColor jk_colorWithHexString:@"#06CB94"]
//APP主题色（橙黄色）
#define KAppContentColor          [UIColor jk_colorWithHexString:@"#FF4800"]

//MARK:系统型号
#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)


#define isIMIphoneX ({\
BOOL IMIphoneX = NO;\
if (@available(iOS 11.0, *)) {\
    if ([UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom>0) {\
IMIphoneX = YES;\
    }\
}\
IMIphoneX;\
})


#define IMKsafeAreaBottom                         (isIMIphoneX?34:0.01f)
#define IMKsafeAreaStatusBarHeight                (isIMIphoneX?44.0f:20.0f)

//MARK:常量参数
#define KLogin_LeftMargin                       adaptWidth750(29*2)
#define KDefault_LeftMargin                     adaptWidth750(17.5*2)
#define kNavigationBarHeight                    (isIMIphoneX?88:64)
#define kTabBarHeight                           49.0f
#define kNavBtnRect                             CGRectMake(0.0f, 0.0f, 44.0f, 43.0f)
#define KLandScapeBarHeight                      32.0f //横屏状态下导航栏高度
#define kLeftDefalutMargin                       adaptWidth750(20*2)

#define kImNavigationBarHeight                    64

#define KAPPWindow       [UIApplication sharedApplication].keyWindow
#define AppDelegateInstance  ((AppDelegate *)[UIApplication sharedApplication].delegate)
#define kNetworkError       @"网络请求失败,请重试"

#define SCREEN_SIZE                 [[UIScreen mainScreen] bounds].size
#define IMSCREEN_WIDTH  ([UIScreen mainScreen].bounds.size.width)
#define IMSCREEN_HEIGHT  ([UIScreen mainScreen].bounds.size.height)


// View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]

#ifdef DEBUG
#define NSSLog(fmt, ...) NSLog((@"function：%s [Line：%d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define NSLog(...)
#endif

#endif /* DSSetingConfigure_h */




